﻿CREATE PROCEDURE [ProductFeedback].[GetProductFeedbackMetadata]
	@TenantId uniqueidentifier
AS

-- 1st
SELECT 
	PFB.BadgeId,
	PFB.WellKnownBadgeCode
FROM
	ProductFeedbackBadge PFB
WHERE
	PFB.TenantId = @TenantId

-- 2nd
SELECT 
	PRA.AttributeId,
	PRA.DefaultText
FROM
	ProductRatingAttribute PRA
WHERE
	PRA.TenantId = @TenantId
	
-- 3rd
SELECT
	PRAL.AttributeId,
	PRAL.CultureId,
	PRAL.Text
FROM
	ProductRatingAttributeLocalization PRAL
	INNER JOIN ProductRatingAttribute PRA ON PRAL.TenantId = PRA.TenantId AND PRAL.AttributeId = PRA.AttributeId
WHERE
	PRA.TenantId = @TenantId

-- 4th
SELECT
	PRA.AttributeId,
	PRA.DefaultText
FROM
	ProductRecommendationAttribute PRA
WHERE
	PRA.TenantId = @TenantId
	
-- 5th
SELECT
	PRAL.AttributeId,
	PRAL.CultureId,
	PRAL.Text
FROM
	ProductRecommendationAttributeLocalization PRAL
	INNER JOIN ProductRecommendationAttribute PRA ON PRAL.TenantId = PRA.TenantId AND PRAL.AttributeId = PRA.AttributeId
WHERE
	PRA.TenantId = @TenantId

-- 6th
SELECT
	PRA.AttributeId,
	PRA.DefaultText
FROM
	ProductReviewAttribute PRA
WHERE
	PRA.TenantId = @TenantId
	
-- 7th
SELECT
	PRAL.AttributeId,
	PRAL.CultureId,
	PRAL.Text
FROM
	ProductReviewAttributeLocalization PRAL
	INNER JOIN ProductReviewAttribute PRA ON PRAL.TenantId = PRA.TenantId AND PRAL.AttributeId = PRA.AttributeId
WHERE
	PRA.TenantId = @TenantId
